package pl.vanta.mjuzik2.guice.modules;

import java.util.ArrayList;
import java.util.List;

import pl.vanta.mjuzik2.api.FileFormat;
import pl.vanta.mjuzik2.api.PlaylistType;
import pl.vanta.mjuzik2.api.services.FormatService;
import pl.vanta.mjuzik2.api.services.PlayerService;
import pl.vanta.mjuzik2.api.services.PlaylistService;
import pl.vanta.mjuzik2.impl.formats.FormatServiceImpl;
import pl.vanta.mjuzik2.impl.player.BasicPlayerServiceImpl;
import pl.vanta.mjuzik2.impl.player.formats.mp3.Mp3Format;
import pl.vanta.mjuzik2.impl.playlists.PlaylistServiceImpl;
import pl.vanta.mjuzik2.impl.playlists.types.M3uPlaylistType;
import pl.vanta.mjuzik2.impl.playlists.types.PlsPlaylistType;

import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Scopes;

public class MusicModule extends AbstractModule
{
	@Override
	protected void configure()
	{
		bind(PlayerService.class).to(BasicPlayerServiceImpl.class).in(Scopes.SINGLETON);
		bind(PlaylistService.class).to(PlaylistServiceImpl.class).in(Scopes.SINGLETON);
		bind(FormatService.class).to(FormatServiceImpl.class).in(Scopes.SINGLETON);
	}

	@Provides
	public List<FileFormat> getFormats()
	{
		List<FileFormat> formats = new ArrayList<FileFormat>();

		formats.add(new Mp3Format());

		return formats;
	}

	@Provides
	public List<PlaylistType> getPlaylistTypes()
	{
		List<PlaylistType> playlistTypes = new ArrayList<PlaylistType>();

		playlistTypes.add(new M3uPlaylistType());
		playlistTypes.add(new PlsPlaylistType());

		return playlistTypes;
	}
}